/*
*Copyright 2021-2023 NERCIS
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/

package cn.ac.nercis.pes.community.model.vo.evaluation;

import cn.ac.nercis.pes.common.constant.evaluation.EvaluationConclusion;
import javafx.beans.property.*;
import org.apache.commons.lang3.StringUtils;

/**
 * 单元测评信息修改视图模型
 * @author zpy
 * @version 1.0.0
 */
public class UnitEvaluationVO {
    private final SimpleStringProperty id = new SimpleStringProperty();
    private final SimpleStringProperty systemId = new SimpleStringProperty();
    private final SimpleStringProperty layerTargetId = new SimpleStringProperty();
    private final SimpleStringProperty unitTargetId = new SimpleStringProperty();
    private final SimpleStringProperty unitTargetName = new SimpleStringProperty();
    private final ObjectProperty<EvaluationConclusion> conclusion = new SimpleObjectProperty<>();
    private final SimpleStringProperty resultAnalysis = new SimpleStringProperty();
    private final BooleanProperty isApply = new SimpleBooleanProperty();
    private final BooleanProperty hasRecord = new SimpleBooleanProperty();

    private boolean change = false;

    public boolean isChange(){
        return change;
    }

    public void resetChange(){
        change = false;
    }

    public String getId() {
        return id.get();
    }

    public SimpleStringProperty idProperty() {
        return id;
    }

    public void setId(String id) {
        this.id.set(id);
    }

    public String getSystemId() {
        return systemId.get();
    }

    public SimpleStringProperty systemIdProperty() {
        return systemId;
    }

    public void setSystemId(String systemId) {
        this.systemId.set(systemId);
    }

    public String getLayerTargetId() {
        return layerTargetId.get();
    }

    public SimpleStringProperty layerTargetIdProperty() {
        return layerTargetId;
    }

    public void setLayerTargetId(String layerTargetId) {
        this.layerTargetId.set(layerTargetId);
    }

    public String getUnitTargetId() {
        return unitTargetId.get();
    }

    public SimpleStringProperty unitTargetIdProperty() {
        return unitTargetId;
    }

    public void setUnitTargetId(String unitTargetId) {
        this.unitTargetId.set(unitTargetId);
    }

    public String getUnitTargetName() {
        return unitTargetName.get();
    }

    public SimpleStringProperty unitTargetNameProperty() {
        return unitTargetName;
    }

    public void setUnitTargetName(String unitTargetName) {
        this.unitTargetName.set(unitTargetName);
    }

    public EvaluationConclusion getConclusion() {
        return conclusion.get();
    }

    public ObjectProperty<EvaluationConclusion> conclusionProperty() {
        return conclusion;
    }

    public void setConclusion(EvaluationConclusion conclusion) {
        this.conclusion.set(conclusion);
    }

    public String getResultAnalysis() {
        return resultAnalysis.get();
    }

    public SimpleStringProperty resultAnalysisProperty() {
        return resultAnalysis;
    }

    public void setResultAnalysis(String resultAnalysis) {
        if(!StringUtils.equals(getResultAnalysis(),resultAnalysis)){
            change = true;
        }
        this.resultAnalysis.set(resultAnalysis);
    }

    public boolean isIsApply() {
        return isApply.get();
    }

    public BooleanProperty isApplyProperty() {
        return isApply;
    }

    public void setIsApply(boolean isApply) {
        this.isApply.set(isApply);
    }

    public boolean isHasRecord() {
        return hasRecord.get();
    }

    public BooleanProperty hasRecordProperty() {
        return hasRecord;
    }

    public void setHasRecord(boolean hasRecord) {
        this.hasRecord.set(hasRecord);
    }
}